package com.gupao.ldr.vip.pattern.factory.simple;


import com.gupao.ldr.vip.pattern.factory.BMWCar;
import com.gupao.ldr.vip.pattern.factory.Car;
import com.gupao.ldr.vip.pattern.factory.LandRoverCar;

/**
 * 简单工厂模式
 */
public class SimpleFactory {

    public static Car getCar(String carName){
        if ("宝马".equals(carName)) {
            return new BMWCar();
        }else if ("路虎".equals(carName)){
            return new LandRoverCar();
        }else {
            return null;
        }
    }
}
